package com.lvmama.rhino.enums;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/** 
* @ClassName: CommonParentType 
* @Description: TODO
* @author shenlinli
* @date 2017年3月23日 下午5:40:13  
*/
public enum CommonSearchFilter {
    
    lvmamaRecommend("1","0","驴妈妈推荐","sort"),
    todayTicketFlag("2","0","今日可订","todayTicketFlag"),
    
    /*门票*/
    filterForTicket("3","0","筛选","filter"),
    county("4","3","景点区域","county"),
    subject("5","3","景点主题","subject"),
    viewActivity("6","3","景点活动","subject"),
    
    activeFlag("7","6","景点活动 ","activeFlag"),
    promotionFlag("8","6","促销活动 ","promotionFlag"),
    
    ticketStar("9","3","景点级别","ticketStar"),
    
    /*酒店*/
    hotelPriceStar("10","0","星级价格","hotelPriceStar"),
    hotelPrice("11","10","价格","price"),
    hotelStar("12","10","星级","hotelStar"),
    landMarkIds("13","0","酒店位置","landMarkIds"),
    facilities("14","0","酒店设施","facilities"),
    
    /*游轮*/
    filterForShip("15","0","筛选","filter"),
    month("16","15","开航日期","month"),
    line("17","15","邮轮航线","line"),
    brand("18","15","游轮公司","brand"),
    start("19","15","出发港口","start"),
    
    /*签证*/
    visaType("20","0","全部类型","visaType"),
    rangeId("21","0","不限领域","rangeId"),
   
    /*日期天数*/
    dateNum("22","0","日期天数","dateNum"),
    routeNum("23","22","游玩天数","routeNum"),
    startMonths("24","22","出发日期","startMonths"),
    startDate("55","22","出发日期","startDate"),
    endDate("56","22","出发日期","endDate"),
   
    districtId("25","0","出发地","districtId"),
    
    routeViewTheme("26","0","景点主题","routeViewTheme"),
    viewPiont("27","26","景点","viewPiont"),
    subjectId("28","26","主题","subjectId"),

    /*酒+景*/
    filterForScenictour("29","0","筛选","filter"),
    scenicDestId("30","29","包含地区","destId"),
    scenicPrice("31","29","价格范围","price"),
    scenicHotelStar("32","29","酒店星级","hotelStar"),

    /*跟团游、旅游推荐*/
    filterForRoute("33","0","筛选","filter"),
    routeDestId("34","33","包含地区","destId"),
    routeViewPiont("35","33","景点","viewPiont"),
    routeSubjectId("36","33"," 主题","subjectId"),
    routePrice("37","33","价格范围","price"),
    routePlayMethod("38","33","线路玩法","playMethod"),

    /*自由行*/
    filterForFreetour("39","0","筛选","filter"),
    freetourDestId("40","39","包含地区","destId"),
    freetourViewPiont("41","39","景点","viewPiont"),
    freetourSubjectId("42","39"," 主题","subjectId"),
    freetourPrice("43","39","价格范围","price"),
    
    /*当地游*/
    filterForLocal("44","0","筛选","filter"),
    localDestId("45","44","包含地区","destId"),
    localDistrictId("44","39","出发地","districtId"),
    localPrice("47","44","价格范围","price"),
    localPlayMethod("48","44","线路玩法","playMethod"),
    
    
    /*交通+服务*/
    filterForPlay("49","0","筛选","filter"),
    playDestId("50","49","包含地区","destId"),
    playViewPiont("51","49","景点","viewPiont"),
    playSubjectId("52","49","主题","subjectId"),
    playPrice("53","49","价格范围","price"),
    playTraffic("54","49","交通工具","traffic");
    
    
    private String selfId;
    private String parentId;
    private String showName;
    private String englishName;
    private CommonSearchFilter(String selfId, String parentId, String showName,String englishName) {
        this.setSelfId(selfId);
        this.parentId = parentId;
        this.showName = showName;
        this.setEnglishName(englishName);
    }
    public String getParentId() {
        return parentId;
    }
    public void setParentId(String parentId) {
        this.parentId = parentId;
    }
    public String getShowName() {
        return showName;
    }
    public void setShowName(String showName) {
        this.showName = showName;
    }
    public String getSelfId() {
    	return selfId;
    }
    public void setSelfId(String selfId) {
    	this.selfId = selfId;
    }
    public String getEnglishName() {
    	return englishName;
    }
    public void setEnglishName(String englishName) {
    	this.englishName = englishName;
    }
    
    public static CommonSearchFilter[] getTicketFilter(){
        CommonSearchFilter[] typeArr = new CommonSearchFilter[9];
        typeArr[0] = CommonSearchFilter.lvmamaRecommend;
        typeArr[1] = CommonSearchFilter.todayTicketFlag;
        typeArr[2] = CommonSearchFilter.filterForTicket;
        typeArr[3] = CommonSearchFilter.county;
        typeArr[4] = CommonSearchFilter.subject;
        typeArr[5] = CommonSearchFilter.viewActivity;
        typeArr[6] = CommonSearchFilter.activeFlag;
        typeArr[7] = CommonSearchFilter.promotionFlag;
        typeArr[8] = CommonSearchFilter.ticketStar;
        return typeArr;
    }
    
    public static CommonSearchFilter[] getHotleFilter(){
        CommonSearchFilter[] typeArr = new CommonSearchFilter[6];
        typeArr[0] = CommonSearchFilter.lvmamaRecommend;
        typeArr[1] = CommonSearchFilter.hotelPriceStar;
        typeArr[2] = CommonSearchFilter.hotelPrice;
        typeArr[3] = CommonSearchFilter.hotelStar;
        typeArr[4] = CommonSearchFilter.landMarkIds;
        typeArr[5] = CommonSearchFilter.facilities;
        return typeArr;
    }
    
    public static CommonSearchFilter[] getShipFilter(){
        CommonSearchFilter[] typeArr = new CommonSearchFilter[6];
        typeArr[0] = CommonSearchFilter.lvmamaRecommend;
        typeArr[1] = CommonSearchFilter.filterForShip;
        typeArr[2] = CommonSearchFilter.month;
        typeArr[3] = CommonSearchFilter.line;
        typeArr[4] = CommonSearchFilter.brand;
        typeArr[5] = CommonSearchFilter.start;
        return typeArr;
    }
    
    
    public static CommonSearchFilter[] getVisaFilter(){
        CommonSearchFilter[] typeArr = new CommonSearchFilter[3];
        typeArr[0] = CommonSearchFilter.lvmamaRecommend;
        typeArr[1] = CommonSearchFilter.visaType;
        typeArr[2] = CommonSearchFilter.rangeId;
        return typeArr;
    }
    
    
    public static CommonSearchFilter[] getScenictourFilter(){
        CommonSearchFilter[] typeArr = new CommonSearchFilter[13];
        typeArr[0] = CommonSearchFilter.lvmamaRecommend;
        typeArr[1] = CommonSearchFilter.dateNum;
        typeArr[2] = CommonSearchFilter.routeNum;
        typeArr[3] = CommonSearchFilter.startMonths;
        typeArr[4] = CommonSearchFilter.routeViewTheme;
        typeArr[5] = CommonSearchFilter.viewPiont;  
        typeArr[6] = CommonSearchFilter.subjectId;
        typeArr[7] = CommonSearchFilter.filterForScenictour;
        typeArr[8] = CommonSearchFilter.scenicDestId;
        typeArr[9] = CommonSearchFilter.scenicPrice;
        typeArr[10] = CommonSearchFilter.scenicHotelStar;
        typeArr[11] = CommonSearchFilter.startDate;
        typeArr[12] = CommonSearchFilter.endDate;
        return typeArr;
    }
    
    
    public static CommonSearchFilter[] getLocalFilter(){
        CommonSearchFilter[] typeArr = new CommonSearchFilter[14];
        typeArr[0] = CommonSearchFilter.lvmamaRecommend;
        typeArr[1] = CommonSearchFilter.dateNum;
        typeArr[2] = CommonSearchFilter.routeNum;
        typeArr[3] = CommonSearchFilter.startMonths;
        typeArr[4] = CommonSearchFilter.routeViewTheme;
        typeArr[5] = CommonSearchFilter.viewPiont;  
        typeArr[6] = CommonSearchFilter.subjectId;
        typeArr[7] = CommonSearchFilter.filterForLocal;
        typeArr[8] = CommonSearchFilter.localDestId;
        typeArr[9] = CommonSearchFilter.localDistrictId;
        typeArr[10] = CommonSearchFilter.localPlayMethod;
        typeArr[11] = CommonSearchFilter.localPrice;
        typeArr[12] = CommonSearchFilter.startDate;
        typeArr[13] = CommonSearchFilter.endDate;
        return typeArr;
    }
    
    
    public static CommonSearchFilter[] getRouteFilter(){
        CommonSearchFilter[] typeArr = new CommonSearchFilter[13];
        typeArr[0] = CommonSearchFilter.lvmamaRecommend;
        typeArr[1] = CommonSearchFilter.dateNum;
        typeArr[2] = CommonSearchFilter.routeNum;
        typeArr[3] = CommonSearchFilter.startMonths;
        typeArr[4] = CommonSearchFilter.districtId;
        typeArr[5] = CommonSearchFilter.filterForRoute;
        typeArr[6] = CommonSearchFilter.routeDestId;
        typeArr[7] = CommonSearchFilter.routeViewPiont;
        typeArr[8] = CommonSearchFilter.routeSubjectId;
        typeArr[9] = CommonSearchFilter.routePrice;
        typeArr[10] = CommonSearchFilter.routePlayMethod;
        typeArr[11] = CommonSearchFilter.startDate;
        typeArr[12] = CommonSearchFilter.endDate;
        return typeArr;
    }
    
    
    public static CommonSearchFilter[] getFreetourFilter(){
        CommonSearchFilter[] typeArr = new CommonSearchFilter[12];
        typeArr[0] = CommonSearchFilter.lvmamaRecommend;
        typeArr[1] = CommonSearchFilter.dateNum;
        typeArr[2] = CommonSearchFilter.routeNum;
        typeArr[3] = CommonSearchFilter.startMonths;
        typeArr[4] = CommonSearchFilter.districtId;
        typeArr[5] = CommonSearchFilter.filterForFreetour;
        typeArr[6] = CommonSearchFilter.freetourDestId;
        typeArr[7] = CommonSearchFilter.freetourViewPiont;
        typeArr[8] = CommonSearchFilter.freetourSubjectId;
        typeArr[9] = CommonSearchFilter.freetourPrice;
        typeArr[10] = CommonSearchFilter.startDate;
        typeArr[11] = CommonSearchFilter.endDate;
        return typeArr;
    }
    
    
    public static CommonSearchFilter[] getPlayFilter(){
        CommonSearchFilter[] typeArr = new CommonSearchFilter[13];
        typeArr[0] = CommonSearchFilter.lvmamaRecommend;
        typeArr[1] = CommonSearchFilter.dateNum;
        typeArr[2] = CommonSearchFilter.routeNum;
        typeArr[3] = CommonSearchFilter.startMonths;
        typeArr[4] = CommonSearchFilter.districtId;
        typeArr[5] = CommonSearchFilter.filterForPlay;
        typeArr[6] = CommonSearchFilter.playDestId;
        typeArr[7] = CommonSearchFilter.playViewPiont;
        typeArr[8] = CommonSearchFilter.playSubjectId;
        typeArr[9] = CommonSearchFilter.playPrice;
        typeArr[10] = CommonSearchFilter.playTraffic;
        typeArr[11] = CommonSearchFilter.startDate;
        typeArr[12] = CommonSearchFilter.endDate;
        return typeArr;
    }
    
   public static List<CommonSearchFilter> filterListByCategory(String category_code){
	   List<CommonSearchFilter> filterList = new ArrayList<CommonSearchFilter>();
	   switch(category_code) { 
		   case "ROUTE": 
			   filterList = Arrays.asList(getRouteFilter());
			   break; 
		   case "TICKET": 
			   filterList = Arrays.asList(getTicketFilter());
			   break; 
		   case "SCENICTOUR": 
			   filterList = Arrays.asList(getScenictourFilter());
			   break; 
		   case "FREETOUR": 
			   filterList = Arrays.asList(getFreetourFilter());
			   break; 
		   case "GROUP": 
			   filterList = Arrays.asList(getRouteFilter());
			   break; 
		   case "PLAY": 
			   filterList = Arrays.asList(getPlayFilter());
			   break; 
		   case "LOCAL": 
			   filterList = Arrays.asList(getLocalFilter());
			   break; 
		   case "HOTEL": 
			   filterList = Arrays.asList(getHotleFilter());
			   break; 
		   case "SHIP": 
			   filterList = Arrays.asList(getShipFilter());
			   break; 
		   case "VISA": 
			   filterList = Arrays.asList(getVisaFilter());
			   break; 
	   } 
	   return filterList;
   }
    
  /*是否有父级*/ 
   public static boolean hasParentFlag(String englishName ,String category_code){
	  boolean flag = false;
	  List<CommonSearchFilter> types = filterListByCategory(category_code);
	   for (CommonSearchFilter type : types) {
           if (type.getEnglishName().equals(englishName)) {
        	   if(!"0".equals(type.parentId)){
        		   flag = true;
                   break;
        	   }
           }
       }
	   return flag;
   } 
   
   /*根据id获取中文名称*/
   public static String getShowNameById(String selfId){
	   String showName = "";
	   CommonSearchFilter[] types = CommonSearchFilter.values();
	   for (CommonSearchFilter type : types) {
           if (type.getSelfId().equals(selfId)) {
        	   showName = type.getShowName();
               break;
           }
       }
	   return showName;
   } 
   
  /*根据英文名称获取中文名称*/
  public static String getShowName(String englishName,String category_code){
	  String showName = "";
	  List<CommonSearchFilter> filterList = filterListByCategory(category_code);
	  for (CommonSearchFilter filter : filterList) {
          if (filter.getEnglishName().equals(englishName)) {
        	  showName = filter.getShowName();
        	  break;
          }
      }
	  return showName;
  }
    
  /*根据英文名称获取父级名称*/
  public static String getParentShowName(String englishName,String category_code){
	  String showName = "";
	  if(hasParentFlag(englishName,category_code)){
		  List<CommonSearchFilter> filterList = filterListByCategory(category_code);
		  for (CommonSearchFilter filter : filterList) {
	          if (filter.getEnglishName().equals(englishName)) {
	        	  showName = getShowNameById(filter.getParentId());
	        	  break;
	          }
	      }
	  }
	  return showName;
  }

  

}
